package com.javastudy.autowiredStudy.restTemplateStudy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

import java.util.Collections;

/**
 * @author mac
 * @date 2021/9/7 6:05 下午
 */
@Configuration
public class RestTemplateConf {

    @Autowired
    private RestTemplateIntercepter restTemplateIntercepter;

    @Bean
    public RestTemplate getRestTemplate(){
        RestTemplate restTemplate = new RestTemplate();
        restTemplate.setInterceptors(Collections.singletonList(restTemplateIntercepter));
        return restTemplate;
    }

}
